Feat/block replay time#7205
Conversation
| cpu_instructions: profiler_result.cpu_instructions, | ||
| cpu_cycles: profiler_result.cpu_cycles, | ||
| cpu_ref_cycles: profiler_result.cpu_ref_cycles, | ||
| execution_time_millis: execution_duration.as_millis() as u64, |
There was a problem hiding this comment.
Could be worth it to use nanos resolutions instead? I know this is a raw profiling, but just to avoid 0 in case a tx takes less then 1ms.
| let err = match tx_result { | ||
| TransactionResult::Success(tx_result) => { | ||
| txs_receipts.push((tx_result.receipt, profiler_result)); | ||
| txs_receipts.push((tx_result.receipt, start.elapsed(), profiler_result)); |
There was a problem hiding this comment.
computing execution_time_millis sounds like a profiler feature. Why not assigning this responsibility to BlockReplayProfiler to centralize all this kind of data collection? It could be available for both linux and not linux build.
| cpu_instructions: profiler_result.cpu_instructions, | ||
| cpu_cycles: profiler_result.cpu_cycles, | ||
| cpu_ref_cycles: profiler_result.cpu_ref_cycles, | ||
| execution_time_millis: execution_duration.as_millis() as u64, |
There was a problem hiding this comment.
I would suggest organizing the response under a profiler field, aggregating all the current profiling-related fields beneath it. This would allow us to simply mark the parent field as nullable, while also making the structure cleaner, easier to evolve and piloted by the RPC request profiler parameter.
Additionally, this approach would integrate nicely with the refactoring proposed in #7205 (comment).
Description
This simple patch adds a new information to every transaction in the blockreplay/simulate api: execution_time_millis
It is the amount of wall-clock milliseconds required for executing the transaction. It is a simple fallback for those platform
without hardware profiler support.
Note: the patch fixes a bunch of error in the openapi schema
Applicable issues
Additional info (benefits, drawbacks, caveats)
Checklist
docs/property-testing.md)changelog.d/README.md)rpc/openapi.yamlfor RPC endpoints,event-dispatcher.mdfor new events)clarity-benchmarkingrepo